package org.android.bbdroid.webservice.data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class Forum
  implements Iterable<Forum>, Serializable
{
  private String description;
  private int id;
  private String name;
  private Map<Integer, Forum> subforums;

  public Forum(int id, String name)
  {
    this(id, name, "");
  }

  public Forum(int id, String name, String description)
  {
    this.id = id;
    this.name = name;
    this.description = description;
    this.subforums = new HashMap<Integer,Forum>();
  }

  public void addForum(Forum f)
  {
    this.subforums.put(f.getId(), f);
  }

  public String getDescription()
  {
    return this.description;
  }

  public int getId()
  {
    return this.id;
  }

  public String getName()
  {
    return this.name;
  }

  public Iterator<Forum> iterator()
  {
    return this.subforums.values().iterator();
  }

  public String toString()
  {
    return this.name;
  }
}